
<?php 
	/* PHP que faz a conecção com a base de dados */

	/*Tratamento de caracteres especiais na base de dados*/
	// header('Content-Type: text/html; charset=utf-8');
	
	$db = mysql_connect($Servername, $Dbusername, $Dbpassword);

	if (!$db) {
		die('Not connected : ' . mysql_error());
	}

	$db_selected = mysql_select_db($Dbname, $db);

	if (!$db_selected) {
		die ('Can\'t use'.$Dbname.' : ' . mysql_error());
	}

	mysql_set_charset('utf8', $db);
	//Define a codifica��o utf8
	mysql_query ("SET NAMES utf8");

	/*# Aqui est� o segredo*/
	mysql_query("SET NAMES 'utf8'");
	mysql_query('SET character_set_connection=utf8');
	mysql_query('SET character_set_client=utf8');
	mysql_query('SET character_set_results=utf8');
?>
